package com.lj.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lj.mapper.ProjectljMapper;
import com.lj.pojo.Departmentlj;
import com.lj.pojo.DepartmentljExample;
import com.lj.pojo.Projectlj;
import com.lj.pojo.ProjectljExample;
import com.lj.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProjectServiceImpl implements ProjectService {
    @Autowired
    ProjectljMapper projectljMapper;
    @Override
    public PageInfo selectProject(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        ProjectljExample example=new ProjectljExample();
        example.setOrderByClause("project_name desc");
        List<Projectlj> list=projectljMapper.selectByExample(example);
        PageInfo<Projectlj> pageInfo=new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int insertProject(Projectlj projectlj) {
        return projectljMapper.insert(projectlj);
    }

    @Override
    public int delete(String id) {
        return projectljMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Projectlj getById(String id) {
        return projectljMapper.selectByPrimaryKey(id);
    }

    @Override
    public int update(Projectlj projectlj) {
        return projectljMapper.updateByPrimaryKey(projectlj);
    }
}
